package ljl.codetop300;

import java.util.HashMap;
import java.util.Map;

public class _168_convert_to_excel_title {

  static class test {
    public String convertToTitle(int columnNumber) {
      StringBuffer sb = new StringBuffer();
      while (columnNumber > 0) {
        int c = (columnNumber - 1) % 26 + 1;
        sb.append((char) (c + 'A' - 1));
        columnNumber = (columnNumber - c) / 26;
      }
      return sb.reverse().toString();
    }
  }

  static class off {
    public String convertToTitle(int columnNumber) {
      StringBuffer sb = new StringBuffer();
      while (columnNumber > 0) {
        int a0 = (columnNumber - 1) % 26 + 1;
        sb.append((char)(a0 - 1 + 'A'));
        columnNumber = (columnNumber - a0) / 26;
      }
      return sb.reverse().toString();
    }
  }
}
